home *** CD-ROM | disk | FTP | other *** search
/ Level 2005 Christmas (DVD) / Level_2005-XMAS_134_DVD_Knightshift.iso / Demos / Ski Racing 2006 / setup1.cab / DataCommonShadersMatrixPaletteSkinning.NSF < prev    next >
Encoding:
Text File  |  2005-11-03  |  5.7 KB  |  188 lines

  1. // MatrixPaletteSkinning shader file.
  2. // This shader performs a simple matrix palette skinning implementation
  3. //
  4.  
  5. // For non-textured objects
  6. NSFShader MatrixPaletteSkinning
  7. {
  8.     "A simple skinning example.
  9.     Supports 20 bones per
  10.     partition."
  11.  
  12.     // Attribute list
  13.     Attributes
  14.     {
  15.         Attrib_Color
  16.             SelectedColor
  17.             Artist
  18.             1.0,1.0,1.0,1.0
  19.             [(0.0,0.0,0.0,0.0)  (1.0,1.0,1.0,1.0)]
  20.     }
  21.  
  22.     // Packing Definition
  23.     PackingDef PosBlendWeightBlendIndicesNormUV0
  24.     {
  25.         PD_Stream   0
  26.             PDP_Position        0   PDT_Float3
  27.             PDP_BlendWeights    1   PDT_Float3
  28.             PDP_BlendIndices    2   PDT_UByteColor
  29.             PDP_Normal          3   PDT_Float3
  30.             PDP_TexCoord0       7   PDT_Float2
  31.     }
  32.     
  33.     // Implementation
  34.     Implementation VS11
  35.     {
  36.         "This implementation is intended for hardware 
  37.          that supports vertex shader version 1.1"
  38.         
  39.         // Requirements for this implementation
  40.         Requirements
  41.         {
  42.             Platform                = DX8|DX9|XBOX|XENON
  43.             VSVersion               = v1.1
  44.             UserVersion             = v0.0
  45.             PSVersion               = v0.0
  46.             BinormalTangentMethod   = NBTMethod_None
  47.             BonesPerPartition       = 20
  48.             UsesNiRenderState       = true
  49.         }
  50.         
  51.         // Packing Definition it uses
  52.         PackingDef  PosBlendWeightBlendIndicesNormUV0
  53.  
  54.         // 'Global' render states
  55.         RenderStates
  56.         {
  57.             AlphaBlendEnable    = false
  58.             SrcBlend            = SrcAlpha
  59.             DestBlend           = InvSrcAlpha
  60.             Lighting            = false;
  61.         }
  62.  
  63.         // First pass
  64.         Pass Pass0
  65.         {
  66.             // Vertex shader program
  67.             VSProgram   "MatrixPaletteSkinning"
  68.  
  69.             // Vertex Shader constant map
  70.             VS_Constantmap
  71.             {
  72.                 CM_Defined      SkinWorldViewProjTranspose  0   0
  73.                 CM_Defined      MaterialDiffuse             4   0
  74.                 CM_Constant     const_1_1_1_255             5   1   1.0,1.0,1.0,765.01
  75.                 CM_Defined      BoneMatrix3                 10  0   20
  76.             }
  77.             
  78.             // Texture stage 0
  79.             Stage 0 Stage0
  80.             {
  81.                 TSS_ColorOp     = TOP_SelectArg2
  82.                 TSS_ColorArg1   = TA_Texture
  83.                 TSS_ColorArg2   = TA_Diffuse
  84.                 TSS_AlphaOp     = TOP_Disable
  85.                 TSS_Texture     = NTM_Base
  86.             }
  87.             
  88.             // Sampler stage 0
  89.             Sampler 0   Sampler0
  90.             {
  91.                 TSAMP_AddressU  = TADDR_Wrap
  92.                 TSAMP_AddressV  = TADDR_Wrap
  93.                 TSAMP_AddressW  = TADDR_Wrap
  94.                 TSAMP_MagFilter = TEXF_Linear
  95.                 TSAMP_MinFilter = TEXF_Linear
  96.                 TSAMP_MipFilter = TEXF_None
  97.             }
  98.         }
  99.     }
  100. }
  101.  
  102. // For textured objects
  103. NSFShader MatrixPaletteSkinning_Textured
  104. {
  105.     "A simple skinning example.
  106.     Supports 20 bones per
  107.     partition.  Applies the
  108.     base map."
  109.     
  110.     // Packing Definition
  111.     PackingDef PosBlendWeightBlendIndicesNormUV0
  112.     {
  113.         PD_Stream   0
  114.             PDP_Position        0   PDT_Float3
  115.             PDP_BlendWeights    1   PDT_Float3
  116.             PDP_BlendIndices    2   PDT_UByteColor
  117.             PDP_Normal          3   PDT_Float3
  118.             PDP_TexCoord0       7   PDT_Float2
  119.     }
  120.     
  121.     // Implementation
  122.     Implementation VS11
  123.     {
  124.         "This implementation is intended for hardware 
  125.          that supports vertex shader version 1.1"
  126.         
  127.         // Requirements for this implementation
  128.         Requirements
  129.         {
  130.             Platform                = DX8|DX9|XBOX|XENON
  131.             VSVersion               = v1.1
  132.             UserVersion             = v0.0
  133.             PSVersion               = v0.0
  134.             BinormalTangentMethod   = NBTMethod_None
  135.             BonesPerPartition       = 26
  136.             UsesNiRenderState       = true
  137.         }
  138.         
  139.         // Packing Definition it uses
  140.         PackingDef  PosBlendWeightBlendIndicesNormUV0
  141.  
  142.         // 'Global' render states
  143.         RenderStates
  144.         {
  145.             AlphaBlendEnable    = false
  146.             SrcBlend            = SrcAlpha
  147.             DestBlend           = InvSrcAlpha
  148.             Lighting            = false;
  149.         }
  150.  
  151.         // First pass
  152.         Pass Pass0
  153.         {
  154.             // Vertex shader program
  155.             VSProgram   "MatrixPaletteSkinning"
  156.  
  157.             // Vertex Shader constant map
  158.             VS_Constantmap
  159.             {
  160.                 CM_Defined      SkinWorldViewProjTranspose  0   0
  161.                 CM_Constant     const_1_1_1_255             5   1   1.0,1.0,1.0,765.01
  162.                 CM_Defined      BoneMatrix3                 10  0   26
  163.             }
  164.             
  165.             // Texture stage 0
  166.             Stage 0 Stage0
  167.             {
  168.                 TSS_ColorOp     = TOP_SelectArg1
  169.                 TSS_ColorArg1   = TA_Texture
  170.                 TSS_ColorArg2   = TA_Diffuse
  171.                 TSS_AlphaOp     = TOP_Disable
  172.                 TSS_Texture     = NTM_Base
  173.             }
  174.             
  175.             // Sampler stage 0
  176.             Sampler 0   Sampler0
  177.             {
  178.                 TSAMP_AddressU  = TADDR_Wrap
  179.                 TSAMP_AddressV  = TADDR_Wrap
  180.                 TSAMP_AddressW  = TADDR_Wrap
  181.                 TSAMP_MagFilter = TEXF_Linear
  182.                 TSAMP_MinFilter = TEXF_Linear
  183.                 TSAMP_MipFilter = TEXF_None
  184.             }
  185.         }
  186.     }
  187. }
  188.